package com.john.blog.config.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.john.blog.config.web.interceptor.InitInterceptor;

/**
 * 拦截器配置
 * 
 * @author JiangGengchao
 * @date 2018年2月8日
 */
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private InitInterceptor initInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String pathPatterns = "/**";
        registry.addInterceptor(initInterceptor).addPathPatterns(pathPatterns);
        super.addInterceptors(registry);
    }

}
